********************************************************************************
* Purpose: Imams data analysis - scaleup Eid ul Azha 2020 
* Sub-file: intent variables 
********************************************************************************

	****************************************************************************
	* Load data
	****************************************************************************

	use			"${imamsurvey}/merged_scaleup.dta" , clear 
	
	keep		if consent_statement==1											// Because of the MS sampling strategy, 
																				// we restrict the sample here to people who responded in the baseline / T calls
																				

	****************************************************************************
	* Estimates
	****************************************************************************	

	estimates	clear 
	
	foreach		i in number 1 2 3 4 6 7 9 12 13 14 {

				* Conditional
				reg 		prevention_step_1_`i' treatment_any ///
								prevention_step_0_`i' , robust 	
				
				est 		sto pooled`i'
				
				sum			prevention_step_1_`i' if treatment_any==0
				estadd		scalar cmean = r(mean) 

				
				
				* Lee bounds
				
				leebounds 	prevention_step_1_`i' treatment_any 
				est			sto leebounds`i' 
				
									
	}

	
	foreach		i in completed_call_prevention   {

				reg 		`i' treatment_any ///
								, robust 	
				
				est 		sto `i'p
	
		
				
					
	}
	
	
	
	****************************************************************************
	* Table 
	****************************************************************************

	esttab		pooled* completed_call_preventionp using "${texrct}/scaleup_intent.tex" , ///
					replace star(* .1 ** .05 *** .01) se t(4) b(4) label ///
					scalars("cmean Control group mean Y") ///
					nonotes keep(treat*) fragment
					
	esttab		leebounds* using "${texrct}/scaleup_intent_leebounds.tex" , ///
					replace star(* .1 ** .05 *** .01) se t(4) b(4) label ///
					nonotes fragment
					
